const int pinA = 7; // Assuming physical pin 7 of ATtiny1614 maps to logical pin 2 in megaTinyCore const int pinB = 6; // Assuming physical pin 6 maps to logical pin 1 in megaTinyCore const int ledPin = 3; // LED connected to logical pin 3 (check your pin mapping) volatile bool turned = false; void setup() { pinMode(pinA, INPUT_PULLUP); pinMode(pinB, INPUT_PULLUP); pinMode(ledPin, OUTPUT); // Using Pin Change Interrupts for ATtiny1614 attachInterrupt(digitalPinToInterrupt(pinA), rotaryTurned, CHANGE); } void loop() { if (turned) { digitalWrite(ledPin, HIGH); delay(5000); // Delay keeps the CPU busy; consider using a timer for non-blocking delay digitalWrite(ledPin, LOW); turned = false; } } void rotaryTurned() { turned = true; }